package com.njust.utils;

import java.math.BigDecimal;

/**
 * @author zjwpro@foxmail.com
 * @date 2018/1/19 下午1:54
 */
public class BigDecimalUtil{

    public static double dUtil(Double f,Integer Scale){
        BigDecimal b =new BigDecimal(f);
        double result=b.setScale(Scale,BigDecimal.ROUND_HALF_UP).doubleValue();
        return result;
    }

    public static void main(String[] args) {
        double v = BigDecimalUtil.dUtil(23.34343434343, 2);
        System.out.println(v);
    }
}
